package ltd.dujiabao.springcloud.controller;

import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author : DuJiabao
 * @Project : springcloud
 * @Time : 2021/5/24 16:54
 * @Desc :
 */
@RestController
@Api("Config Client")
@Slf4j
@RefreshScope // 动态刷新
public class ConfigClientController {
  @Value("${config.info}")
  private String info;

  @Value("${config.version}")
  private Integer version;

  @GetMapping("/config/info")
  public String getInfo() {
    String result = "info: " + info + ", version: " + version;
    log.info(result);
    return result;
  }
}
